<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Maven 2 plugin for googlecode - Usage</title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
          <meta name="author" content="Alain Marion" />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>
  <body class="composite">
    <div id="banner">
                    <span id="bannerLeft">
    
            Maven 2 plugin for googlecode
    
            </span>
                    <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
  
  
    
            <div class="xleft">
        Last Published: 2009-09-07
                      </div>
            <div class="xright">      
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
  
  
    
                   <h5>Overview</h5>
            <ul>
              
    <li class="none">
                    <a href="index.html">Introduction</a>
          </li>
              
    <li class="none">
                    <a href="plugin-info.html">Goals</a>
          </li>
              
    <li class="none">
              <strong>Usage</strong>
        </li>
              
    <li class="none">
                    <a href="faq.html">FAQ</a>
          </li>
          </ul>
              <h5>Examples</h5>
            <ul>
              
    <li class="none">
                    <a href="examples/single-project-deployment.html">Single Project Deployment</a>
          </li>
              
    <li class="none">
                    <a href="examples/multi-project-deployment.html">Multi-Modules Project Deployment</a>
          </li>
          </ul>
              <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-reports.html">Project Reports</a>
                </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
  
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>Usage</h2>
<div class="section"><h3>Introduction</h3>
<p>The googlecode Plugin has only one function that will publish you project distribution to the project's googlecode download area. This plugin is intended to be run during the maven <tt>deploy</tt> phase of the build lifecycle and is implemented using the <tt>googlecode:deploy</tt> mojo. </p>
</div>
<div class="section"><h3>The <tt>googlecode:deploy</tt> Mojo</h3>
<p>This mojo has no default invocation phase set, therefore you will have to call it explicitly using <tt>googlecode:deploy</tt></p>
<p>In most cases, you are willing to invoke this mojo when you call the <tt>deploy</tt> phase of the default build lifecycle. In order to do that, you can configure the plugin to attach the deploy goals to the deploy phase of the build lifecycle: </p>
<div class="source"><pre>[...]
&lt;pluginManagement&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;googlecode.maven.plugin&lt;/groupId&gt;
        &lt;artifactId&gt;maven-googlecode-plugin&lt;/artifactId&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;phase&gt;deploy&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;deploy&lt;/goal&gt;
            &lt;/goals&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
&lt;/pluginManagement&gt;
[...]</pre>
</div>
<p>Once you've configured your plugin target phase, your project's artifact will only require invocation of the <tt>deploy</tt> phase of the build:</p>
<div class="source"><pre>mvn deploy</pre>
</div>
<p>To enable this mojo to function you must add the plugin in your pom <tt>&lt;plugins</tt>&gt; section and provide valid credentials for your googlecode account this have to be done using the server tag of your <tt>settings.xml</tt> file. This can be done the following way:</p>
<div class="source"><pre>[...]
&lt;plugins&gt;
        [...]
    &lt;plugin&gt;
        &lt;artifactId&gt;maven-googlecode-plugin&lt;/artifactId&gt;
        &lt;configuration&gt;
                &lt;site&gt;
                        &lt;id&gt;google.download&lt;/id&gt;
                &lt;/site&gt;
        &lt;/configuration&gt;        
    &lt;/plugin&gt;
    [...]
&lt;/plugins&gt;
[...]</pre>
</div>
<p>Now, you can specify a server definition in your <tt>settings.xml</tt> to provide authentication information this server. Your server section might look like this:</p>
<div class="source"><pre>[...]
&lt;server&gt;
        &lt;id&gt;google.download&lt;/id&gt;
        &lt;username&gt;user&lt;/username&gt;
        &lt;password&gt;passwd&lt;/password&gt;
&lt;/server&gt;
[...]</pre>
</div>
<p>Unfortunately, Maven doesn't currently support hashed or encrypted passwords in the <tt>settings.xml</tt>.</p>
<p>Once you have correctly setup authentication for your googlecode account, your project's artifact will only require invocation of the <tt>googlecode:deploy</tt> phase of the build to publish your deliverable:</p>
<div class="source"><pre>mvn googlecode:deploy</pre>
</div>
<p>Using the previous default simple configuration, your project deliverable will uploaded the following way:</p>
<ul><li>upload url: default googlecode root upload url</li>
<li>project name: <tt>artifactId</tt> for stand alone project, root project <tt>artifactId</tt> for a module of a multi-module project</li>
<li>no summary description</li>
<li>no label attached</li>
<li>the file will be uploaded using the name: <tt>artifiactId</tt>-<tt>version</tt>.type</li>
</ul>
<div class="section"><h4>Optional Parameters</h4>
<p>The default behavior of the plugin can be modified by overrinding default parameters values. </p>
<p>In the following samples the parameters are set in the <tt>&lt;plugins</tt>&gt; definition section, but they can also freely be set in the <tt>&lt;pluginManagment</tt>&gt; section of your pom. On multi-modules projects, definition of the custom configuration will most likely be in the <tt>&lt;pluginManagment</tt>&gt; section of the enclosing pom. </p>
<div class="section"><h5>Upload url</h5>
<p>The location of the upload server can be changed to another <tt>url</tt> in order to do this, just specify an alternate <tt>url</tt> in the <tt>&lt;site</tt>&gt; tag. This is mainly useful for testing purposes.</p>
<div class="source"><pre>[...]
&lt;plugins&gt;
        [...]
    &lt;plugin&gt;
        &lt;artifactId&gt;maven-googlecode-plugin&lt;/artifactId&gt;
        &lt;configuration&gt;
                &lt;site&gt;
                        &lt;id&gt;google.download&lt;/id&gt;
                        &lt;url&gt;http://my-alternate-url&lt;/url&gt;
                &lt;/site&gt;
        &lt;/configuration&gt;        
    &lt;/plugin&gt;
    [...]
&lt;/plugins&gt;
[...]</pre>
</div>
</div>
<div class="section"><h5>Googlecode project name</h5>
<p>In case you use a different than the googlecode name for your project, you can specify an alternate name for your googlecode project by setting the <tt>&lt;googlecode-name</tt>&gt; tag the following way:</p>
<div class="source"><pre>[...]
&lt;plugins&gt;
        [...]
    &lt;plugin&gt;
        &lt;artifactId&gt;maven-googlecode-plugin&lt;/artifactId&gt;
        &lt;configuration&gt;
                &lt;site&gt;
                        &lt;id&gt;google.download&lt;/id&gt;
                &lt;/site&gt;
                &lt;googlecode-name&gt;my_googlecode_project_name&lt;/googlecode-name&gt;
        &lt;/configuration&gt;        
    &lt;/plugin&gt;
    [...]
&lt;/plugins&gt;
[...]</pre>
</div>
</div>
<div class="section"><h5>Summary</h5>
<p>You can add a summary to your upload by specifying the summary parameter.</p>
<div class="source"><pre>[...]
&lt;plugins&gt;
        [...]
    &lt;plugin&gt;
        &lt;artifactId&gt;maven-googlecode-plugin&lt;/artifactId&gt;
        &lt;configuration&gt;
                &lt;site&gt;
                        &lt;id&gt;google.download&lt;/id&gt;
                &lt;/site&gt;
                &lt;summary&gt;my comments&lt;/summary&gt;
        &lt;/configuration&gt;        
    &lt;/plugin&gt;
    [...]
&lt;/plugins&gt;
[...]</pre>
</div>
</div>
<div class="section"><h5>Labels</h5>
<p>You can add some labels to your upload the following way:</p>
<div class="source"><pre>[...]
&lt;plugins&gt;
        [...]
    &lt;plugin&gt;
        &lt;artifactId&gt;maven-googlecode-plugin&lt;/artifactId&gt;
        &lt;configuration&gt;
                &lt;site&gt;
                        &lt;id&gt;google.download&lt;/id&gt;
                &lt;/site&gt;
                &lt;labels&gt;
                        &lt;label&gt;maven&lt;/label&gt;
                        &lt;label&gt;java&lt;/label&gt;
                        [...]   
                &lt;/labels&gt;
        &lt;/configuration&gt;     
    &lt;/plugin&gt;
    [...]
&lt;/plugins&gt;
[...]</pre>
</div>
</div>
</div>
</div>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2009
    
          maven-googlecode-plugin
          
  

  
    
  
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
